import java.util.concurrent.CountDownLatch;

public class Execution {
    public static void main(String[] args) {
        int sum = 10;
        System.out.println("总共有"+sum+"个小任务需要在总任务完成前结束");
        CountDownLatch cl = new CountDownLatch(sum);
        WaitingTask w = new WaitingTask(cl);
        new Thread(w).start();
        for(int i=0;i<sum;i++){
            WorkingTask work = new WorkingTask(cl);
            new Thread(work).start();
        }
    }
}
